"""
包含
1.根据schema获取所需的特征
2.根据所有特征进行排序
"""
import threading


class BaseRank(threading.Thread):
    def __init__(self, config):
        super().__init__()
        self.config = config
        self.args = None

    def init(self, *args):
        self.args = args

    def complete_feature(self, global_resource, request_content, response_content):
        """
        获取本次排序所需的所有feature
        :return:
        """
        pass

    def rank(self, global_resource, request_content, response_content):
        """
        对指定位置的文档进行排序
        :return:
        """

    def run(self) -> None:
        if not self.args:
            print("rank service start without init")
            return
        self.complete_feature(*self.args)
        self.rank(*self.args)
